package com.kuaimacode.kframework.util;

import org.apache.commons.lang3.StringUtils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author qinyong
 * @Title:
 * @Package com.kuaimacode.kframework.util
 * @Description: created by IntelliJ IDEA
 * @date 2019-03-13 22:30
 */
public final class ValidUtil {

    /**
     * 验证是否为手机号
     * @param phone
     * @return
     */
    public static boolean isMobile(String phone) {
        if (StringUtils.isBlank(phone)) {
            return false;
        }
        String regExp = "^(\\d){11}$";
        Pattern p = Pattern.compile(regExp);
        Matcher m = p.matcher(phone);
        return m.matches();
    }
}
